package com.deer.wms.base.system.service.bill.impl;


import com.deer.wms.base.system.model.bill.*;
import com.deer.wms.base.system.model.task.TaskInfoDto;
import com.deer.wms.base.system.model.zh.WorkTasks;
import com.deer.wms.common.core.service.AbstractService;
import com.deer.wms.common.core.text.Convert;
import com.deer.wms.base.system.dao.bill.BillOutMasterMapper;
import com.deer.wms.base.system.service.bill.IBillOutMasterService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * 入库单 服务层实现
 * 
 * @author cai
 * @date 2019-07-17
 */
@Service
public class BillOutMasterServiceImpl extends AbstractService<BillOutMaster, Integer> implements IBillOutMasterService {

	@Autowired
	private BillOutMasterMapper billOutMasterMapper;

	/**
	 * 根据billId查询出库单信息
	 */
	@Override
	public BillOutMasterDto findBillOutMasterDtoByBillId(Integer billId) {
		return billOutMasterMapper.findBillOutMasterDtoByBillId(billId);
	}

	@Override
	public BillOutMasterDto findBillOutMasterDtoByBillNo(String billNo) {
		return billOutMasterMapper.findBillOutMasterDtoByBillNo(billNo);
	}

	/**
	 * 删除入库单信息
	 *
	 * @param ids 需要删除的数据ID
	 * @return 结果
	 */
	public int deleteBillOutMasterByIds(String ids) {
		return billOutMasterMapper.deleteBillOutMasterByIds(Convert.toStrArray(ids));
	}

	/**
	 * 修改BillOutMaster信息
	 *
	 * @param billOutMaster
	 */
	@Override
	public int updateBillOutMaster(BillOutMaster billOutMaster) {
		return billOutMasterMapper.updateBillOutMaster(billOutMaster);
	}

	@Override
	public int auditFinish(Integer billId) {
		return billOutMasterMapper.auditFinish(billId);
	}

	/**
	 * 根据billId查找BillOutMaster
	 *
	 * @return
	 */
	@Override
	public BillOutMaster selectBillOutMasterById(Integer billId) {
		return billOutMasterMapper.selectBillOutMasterById(billId);
	}

	/**
	 * 保存BillOutMaster  出库单
	 *
	 * @param billOutMaster
	 */
	@Override
	public Boolean saveBillOutMaster(BillOutMaster billOutMaster) {
		if(billOutMasterMapper.saveBillOutMaster(billOutMaster) ==1){
			return true;
		}
		return false;
	}

	/**
	 *
	 * 查询出库单
	 *
	 * @return
	 */
	@Override
	public List<BillOutMasterDto> selectBillOutMasterList(BillOutMasterDto billOutMasterDto) {
		return billOutMasterMapper.selectBillOutMasterList(billOutMasterDto);
	}

	@Override
	public BillOutMaster selectBillOutMasterByBillOutDetailId(@Param("billOutDetailId") Integer billOutDetailId){
		return billOutMasterMapper.selectBillOutMasterByBillOutDetailId(billOutDetailId);
	}

	@Override
	public List<BillOutMasterDto> findList(BillOutMasterCriteria criteria){
		return billOutMasterMapper.findList(criteria);
	}

	@Override
	public List<BillOutMasterDto> findExport(BillOutMasterCriteria criteria) {
		return billOutMasterMapper.findExport(criteria);
	}

	@Override
	public int BillOutMasterCount() {
		return billOutMasterMapper.BillOutMasterCount();
	}

	@Override
	public int BillOutMasterCountByType() {
		return billOutMasterMapper.BillOutMasterCountByType();
	}

	@Override
	public List<Integer> getAllWeek() {
		return billOutMasterMapper.getAllWeek();
	}

	@Override
	public List<BillOutDetailDeviceDto> selectDetailStreamList(BillOutDetailDeviceDto billOutDetailDeviceDto) {
		return billOutMasterMapper.selectDetailStreamList(billOutDetailDeviceDto);
	}

	@Override
	public List<BillOutPlanDto> findBillOutPlanByBillId(Integer billId) {
		return billOutMasterMapper.findBillOutPlanByBillId(billId);
	}

	@Override
	public List<BillOutDetailDto> findBillOutDetailByPlanId(Integer planId) {
		return billOutMasterMapper.findBillOutDetailByPlanId(planId);
	}

	@Override
	public List<BillOutDetailDto> findDeviceListByDetailId(BillOutDetail billOutDetail) {
		return billOutMasterMapper.findDeviceListByDetailId(billOutDetail);
	}

	@Override
	public List<BillOutPlanDto> selectBillOutPlanList(BillOutPlanDto BillOutPlanDto) {
		return billOutMasterMapper.selectBillOutPlanList(BillOutPlanDto);
	}

	@Override
	public List<BillOutMasterDto> selectWaitBillOutMasterList(BillOutMasterDto billOutMasterDto) {
		return billOutMasterMapper.selectWaitBillOutMasterList(billOutMasterDto);
	}

	@Override
	public List<DeviceManager> findDeviceList(DeviceManager deviceManager) {
		return billOutMasterMapper.findDeviceList(deviceManager);
	}

	@Override
	public List<MATNRvo> findMATNRByBillId(Integer billId) {
		return billOutMasterMapper.findMATNRByBillId(billId);
	}

	@Override
	public void insertBillOutPlan(BillOutPlan billOutPlan) {
		billOutMasterMapper.insertBillOutPlan(billOutPlan);
	}

	@Override
	public void insertBillOutDetail(BillOutDetail billOutDetail) {
		billOutMasterMapper.insertBillOutDetail(billOutDetail);
	}

	@Override
	public void insertBillOutDetailDevice(BillOutDetailDevice billOutDetailDevice) {
		billOutMasterMapper.insertBillOutDetailDevice(billOutDetailDevice);
	}

	@Override
	public BillOutPlanDto findBillOutPlanByPlanId(Integer planId) {
		return billOutMasterMapper.findBillOutPlanByPlanId(planId);
	}

	@Override
	public void saveTaskId(BillInDetail billInDetail) {
		billOutMasterMapper.saveTaskId(billInDetail);
	}

	@Override
	public List<BillOutDetailDto> getBillOutDetailByPlanId(Integer billOutPlanId) {
		return billOutMasterMapper.getBillOutDetailByPlanId(billOutPlanId);
	}

	@Override
	public void updateSapNoBySapId(BillOutSap billOutSap) {
		billOutMasterMapper.updateSapNoBySapId(billOutSap);
	}

	@Override
	public void updateBillOutDetailStateById(Integer billOutDetailId) {
		billOutMasterMapper.updateBillOutDetailStateById(billOutDetailId);
	}

	@Override
	public int findBillOutOver(Integer planId) {
		return billOutMasterMapper.findBillOutOver(planId);
	}

	@Override
	public void updateBillOutPlanState2(Integer billOutPlanId) {
		billOutMasterMapper.updateBillOutPlanState2(billOutPlanId);
	}

	@Override
	public void updateBillOutPlanState3(Integer billOutPlanId) {
		billOutMasterMapper.updateBillOutPlanState3(billOutPlanId);
	}

	@Override
	public int findSapIdByPlanId(WorkTasks workTasks) {
		return billOutMasterMapper.findSapIdByPlanId(workTasks);
	}

	@Override
	public void updateSapWright(BillOutSapDetail billOutSapDetail) {
		billOutMasterMapper.updateSapWright(billOutSapDetail);
	}

	@Override
	public BillOutSapDetail findDetailWeight(Integer sapId) {
		return billOutMasterMapper.findDetailWeight(sapId);
	}

	@Override
	public void updateSapDetailState(BillOutSapDetail detailWeight) {
		billOutMasterMapper.updateSapDetailState(detailWeight);
	}

	@Override
	public int sumPlan(Integer billOutPlanId) {
		return billOutMasterMapper.sumPlan(billOutPlanId);
	}

	@Override
	public int findSapIdByDetailId(Integer sapId) {
		return billOutMasterMapper.findSapIdByDetailId(sapId);
	}

	@Override
	public void updatePlan(Integer id) {
		billOutMasterMapper.updatePlan(id);
	}

	@Override
	public Integer findBillOutType(Integer id) {
		return billOutMasterMapper.findBillOutType(id);
	}

	@Override
	public void planOver(Integer billOutPlanId) {
		billOutMasterMapper.planOver(billOutPlanId);
	}

	@Override
	public void planDetailOver(Integer billOutPlanId) {
		billOutMasterMapper.planDetailOver(billOutPlanId);
	}

	@Override
	public BillOutDetailDeviceDto getDetailSum(BillOutDetailDeviceDto detailAll) {
		return billOutMasterMapper.getDetailSum(detailAll);
	}


}


